apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: cephcsidriver.deckhouse.io
  labels:
    heritage: deckhouse
    module: ceph-csi
    app: ceph-csi
spec:
  group: deckhouse.io
  scope: Cluster
  names:
    plural: cephcsidriver
    kind: CephCSIDriver
  preserveUnknownFields: false
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema: &schema
        openAPIV3Schema:
          type: object
          description: |
            Ceph cluster connection parameters and StorageClasses configuration.
          required:
            - spec
          properties:
            spec:
              type: object
              required:
                - clusterID
                - userID
                - userKey
                - monitors
              properties:
                clusterID:
                  description: |
                    Ceph cluster FSID/UUID.

                    Use `ceph fsid` to get Ceph cluster FSID/UUID.
                  type: string
                userID:
                  description: |
                    Username without `client.`.
                  type: string
                userKey:
                  description: |
                    Ceph auth key corresponding to the `userID`.
                  type: string
                monitors:
                  description: |
                    List of ceph-mon IP addresses in the format `10.0.0.10:6789`.
                  type: array
                  items:
                    type: string
                rbd:
                  type: object
                  properties:
                    storageClasses:
                      description: |
                        Description of StorageClasses for Rados Block Device (RBD).
                      type: array
                      items:
                        type: object
                        required:
                          - namePostfix
                        properties:
                          namePostfix:
                            description: |
                              Part of the StorageClass name after `-`.

                              The name from the CustomResource `CephCSIDriver` is used as the first part.
                            type: string
                          pool:
                            description: |
                              Ceph pool into which the RBD image shall be created.
                            type: string
                          reclaimPolicy:
                            description: |
                              The reclaim policy for a Persistent Volume.

                              [More info...](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaiming)
                            type: string
                            enum:
                              - Delete
                              - Retain
                            default: Retain
                          allowVolumeExpansion:
                            description: |
                              Allows the users to resize the volume by editing the corresponding PVC object.

                              [More info...](https://kubernetes.io/docs/concepts/storage/storage-classes/#allow-volume-expansion)
                            type: boolean
                            default: true
                          mountOptions:
                            description: |
                              List of mount options.
                            type: array
                            items:
                              type: string
                          defaultFSType:
                            description: |
                              Default fstype.
                            type: string
                            enum:
                              - ext4
                              - xfs
                            default: ext4
                cephfs:
                  type: object
                  properties:
                    subvolumeGroup:
                      description: |
                        CephFS subvolume group name.
                      type: string
                    storageClasses:
                      type: array
                      description: |
                        CephFS StorageClasses.
                      items:
                        type: object
                        required:
                          - namePostfix
                          - fsName
                        properties:
                          namePostfix:
                            description: |
                              Part of the StorageClass name after `-`.

                              The name from the CustomResource `CephCSIDriver` is used as the first part.
                            type: string
                          pool:
                            description: |
                              Ceph pool name into which volume data shall be stored.
                            type: string
                          reclaimPolicy:
                            description: |
                              The reclaim policy for a Persistent Volume.
                            type: string
                            enum:
                              - Delete
                              - Retain
                            default: Retain
                          allowVolumeExpansion:
                            description: |
                              Allows the users to resize the volume by editing the corresponding PVC object.
                            type: boolean
                            default: true
                          mountOptions:
                            description: |
                              List of mount options.
                            type: array
                            items:
                              type: string
                          fsName:
                            description: |
                              CephFS filesystem name.
                            type: string
